using Microsoft.Practices.Composite.Events;
using StockholmsStad.Windows.UI.Modules.Couple.Interfaces;

namespace StockholmsStad.Windows.UI.Modules.Couple.Presenters
{
    public class CoupleSummaryPresenter
    {
        private readonly CouplesListPresenter listPresenter;
        private readonly ICouplesController couplesController;

        public CoupleSummaryPresenter(
            ICoupleSummaryView view,
            CouplesListPresenter listPresenter, ICouplesController couplesController)
        {
            View = view;
            this.listPresenter = listPresenter;
            this.couplesController = couplesController;
            this.listPresenter.CoupleSelected += listPresenter_CoupleSelected;

            View.SetContent(listPresenter.View);
        }

        protected void listPresenter_CoupleSelected(object sender, DataEventArgs<int> e)
        {
            couplesController.OnCoupleSelected(e.Value);
        }

        public ICoupleSummaryView View { get; set; }
    }
}
